package com.thx.dictionary.model;

import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.OrderBy;


@Entity
@Table(name = "sys_dictionary")
public class Dictionary {
	@Id
	@GeneratedValue(generator = "generator")
	@GenericGenerator(name = "generator", strategy = "uuid")
	private String dicnId;
	private String dicName;
	private String dicnCode;
	private String dicnType;
	private String inUse;
	
	private Date createDate;
	
	@OneToMany(mappedBy="dicn")
	@Cascade(CascadeType.ALL)
	@OrderBy(clause = "dicv_order asc")
	private Set<DictionaryValue> dicvs = new LinkedHashSet<DictionaryValue>();
	
	public void addDicValues(DictionaryValue dicv) {
		this.dicvs.add(dicv);
	}
	public String getDicnId() {
		return dicnId;
	}
	public void setDicnId(String dicnId) {
		this.dicnId = dicnId;
	}
	public String getDicName() {
		return dicName;
	}
	public void setDicName(String dicName) {
		this.dicName = dicName;
	}
	
	public Set<DictionaryValue> getDicvs() {
		return dicvs;
	}
	public void setDicvs(Set<DictionaryValue> dicvs) {
		this.dicvs = dicvs;
	}
	public String getDicnCode() {
		return dicnCode;
	}
	public void setDicnCode(String dicnCode) {
		this.dicnCode = dicnCode;
	}
	public String getDicnType() {
		return dicnType;
	}
	public void setDicnType(String dicnType) {
		this.dicnType = dicnType;
	}
	public String getInUse() {
		return inUse;
	}
	public void setInUse(String inUse) {
		this.inUse = inUse;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
}
